From 6dc11dccc6c8147b5b71c86be7e458eebc35f8c5 Mon Sep 17 00:00:00 2001 From: Li Jin Date: Mon, 11 Jan 2021 14:53:31 +0800 Subject: add all the compiler specific linker flags. --- CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 7374e1c..1fcb248 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,7 +26,7 @@ MESSAGE(STATUS "Lua library: ${LUA_LIBRARIES}") enable_language( CXX ) include_directories( src ${LUA_INCLUDE_DIR} ) -add_definitions( -std=c++17 -O3 -fPIC -lstdc++fs -ldl -Wno-unused-command-line-argument ) +add_definitions( -std=c++17 -O3 -fPIC ) add_library( libmoonp MODULE src/MoonP/ast.cpp src/MoonP/parser.cpp src/MoonP/moon_parser.cpp src/MoonP/moon_compiler.cpp src/MoonP/moonplus.cpp) set_target_properties( libmoonp PROPERTIES PREFIX "" ) @@ -35,6 +35,9 @@ target_link_libraries( libmoonp ${LUA_LIBRARIES} ) add_executable( moonp src/MoonP/ast.cpp src/MoonP/moon_compiler.cpp src/MoonP/moon_parser.cpp src/MoonP/moonplus.cpp src/MoonP/parser.cpp src/moonp.cpp ) target_link_libraries( moonp ${LUA_LIBRARIES} ) +if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + target_link_options( moonp PRIVATE -ldl -lpthread -lstdc++fs ) +endif() install(CODE "") -- cgit v1.2.3-55-g6feb