From 1af15e75fe358bb2f923223dfef7cf3be9e8944d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BA=90=E6=96=87=E9=9B=A8?= <41315874+fumiama@users.noreply.github.com> Date: Fri, 12 Apr 2024 22:55:42 +0900 Subject: [PATCH] fix(compile): "/usr/local/bin/cmoe": not found --- CMakeLists.txt | 10 +++++++++- Dockerfile | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2dba913..e58f344 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,11 +5,19 @@ SET(CMAKE_BUILD_TYPE "Release") include_directories("/usr/local/include") link_directories("/usr/local/lib") +if (BUILD NOT STREQUAL "docker") + #在编译选项中加入c99支持 + add_compile_options(-std=c99) + message(STATUS "optional:-std=c99") +endif () + add_executable(cmoe cmoe.c) add_executable(cmoeditor editor.c) target_link_libraries(cmoe spb) target_link_libraries(cmoeditor spb) -#INSTALL(TARGETS cmoe RUNTIME DESTINATION bin) +if (BUILD STREQUAL "docker") + INSTALL(TARGETS cmoe RUNTIME DESTINATION bin) +endif () INSTALL(TARGETS cmoeditor RUNTIME DESTINATION bin) diff --git a/Dockerfile b/Dockerfile index 009e8db..febe8bb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -37,7 +37,7 @@ COPY ./CMakeLists.txt . RUN mkdir build \ && cd build \ - && cmake .. \ + && cmake -DBUILD=docker .. \ && make install FROM alpine:latest